//
//  YYJLHallViewController.m
//  YuanyangJinlou
//
//  Created by mac004 on 2017/1/4.
//  Copyright © 2017年 suli19910309@qq.com. All rights reserved.
//

#import "YYJLHallViewController.h"
#import "YYJLRankCell.h"
@interface YYJLHallViewController ()<UITableViewDelegate,UITableViewDataSource>{
    UITableView * _tableView;
    UIImageView * first;
    UILabel * firstLb;
    UIImageView * level1;
    UILabel * postion1;
    UILabel * location1;
    UILabel * rank1;
    
    UIImageView*second;
    UILabel*secondLb;
    UIImageView*level2;
    UILabel * postion2;
    UILabel * location2;
    UILabel * rank2;
    
    UIImageView * third;
    UILabel*thirdLb;
    UIImageView*level3;
    UILabel * postion3;
    UILabel * location3;
    UILabel * rank3;
}

@end

@implementation YYJLHallViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.navigationController setNavigationBarHidden:NO animated:NO];
    [self setBackItem];
    [self creatUI];
    [self setTitleView:@"名人堂"];
}
-(void)creatUI{
    _tableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) style:UITableViewStylePlain];
    _tableView.dataSource=self;
    _tableView.delegate=self;
    [self.view addSubview:_tableView];
    _tableView.tableHeaderView=[self addHeaderView];
    
    
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    YYJLRankCell*cell=[tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell=[[YYJLRankCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
         cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
   
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 70*PER_HEIGHT;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 17;
}
-(UIView*)addHeaderView{
    UIView*headerView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 235*PER_HEIGHT)];
    headerView.backgroundColor=TINK_COLOR;
    UIImageView*bgView=[[UIImageView alloc]initWithFrame:CGRectMake(12*PER_WIDTH, 15*PER_HEIGHT, 351*PER_WIDTH, 210*PER_HEIGHT)];
    bgView.image=[UIImage imageNamed:@"bg_paihang"];
    [headerView addSubview:bgView];
    //图片
    //第一
    UIImageView*firstBg=[[UIImageView alloc]initWithFrame:CGRectMake(138*PER_WIDTH, 12*PER_WIDTH, 72*PER_WIDTH, 94*PER_HEIGHT)];
    firstBg.image=[UIImage imageNamed:@"ico_NO1"];
    [bgView addSubview:firstBg];
    first = [[UIImageView alloc]initWithFrame:CGRectMake(1*PER_WIDTH, 20, 70*PER_WIDTH, 70*PER_WIDTH)];
    first.image=[UIImage imageNamed:@"touxiang_No1"];
    [firstBg addSubview:first];
    
    firstLb=[MyControl createLabelWithFrame:CGRectMake(117*PER_WIDTH, firstBg.bottom+9*PER_HEIGHT, 125*PER_WIDTH, 15*PER_HEIGHT) Font:15 Text:@"刘星星"];
    firstLb.textAlignment=NSTextAlignmentCenter;
    firstLb.textColor=BLACK_COLOR;
    [bgView addSubview:firstLb];
    
    UIImage*levelImg=[UIImage imageNamed:@"1"];
    
    level1=[[UIImageView alloc]initWithFrame:CGRectMake(162*PER_WIDTH, firstLb.bottom+8*PER_HEIGHT, levelImg.size.width*PER_WIDTH, levelImg.size.height*PER_HEIGHT)];
    level1.image=levelImg;
    [bgView addSubview:level1];
    postion1=[MyControl createLabelWithFrame:CGRectMake(level1.right+10*PER_WIDTH, firstLb.bottom+10*PER_HEIGHT, 60*PER_WIDTH, 12*PER_HEIGHT) Font:12 Text:@"店长" Color:FEELT_COLOR];
    [bgView addSubview:postion1];
    location1=[MyControl createLabelWithFrame:CGRectMake(117*PER_WIDTH, postion1.bottom+10*PER_HEIGHT, 125*PER_WIDTH, 12*PER_HEIGHT) Font:12 Text:@"深圳金珠珠宝店" Color:FEELT_COLOR];
    location1.textAlignment=NSTextAlignmentCenter;
    [bgView addSubview:location1];
    rank1=[MyControl createLabelWithFrame:CGRectMake(117*PER_WIDTH, location1.bottom+9*PER_HEIGHT, 125*PER_WIDTH, 21*PER_HEIGHT) Font:21 Text:@"220" Color:TINK_COLOR];
    rank1.font=[UIFont fontWithName:HLT size:21*PER_WIDTH];
    rank1.textAlignment=NSTextAlignmentCenter;
    [bgView addSubview:rank1];
    
    //第三
    UIImageView*thirdBg=[[UIImageView alloc]initWithFrame:CGRectMake(34*PER_WIDTH, 36*PER_HEIGHT, 50*PER_WIDTH, 70*PER_HEIGHT)];
    thirdBg.image=[UIImage imageNamed:@"ico_No3"];
    [bgView addSubview:thirdBg];
    third=[[UIImageView alloc]initWithFrame:CGRectMake(0, 20*PER_HEIGHT, 50*PER_WIDTH, 50*PER_WIDTH)];
    third.image=[UIImage imageNamed:@"touxiang_No2"];
    [thirdBg addSubview:third];
    
    thirdLb=[MyControl createLabelWithFrame:CGRectMake(0, thirdBg.bottom+5*PER_HEIGHT, 117*PER_WIDTH, 15*PER_HEIGHT) Font:15 Text:@"流星星" Color:BLACK_COLOR];
    thirdLb.textAlignment=NSTextAlignmentCenter;
    [bgView addSubview:thirdLb];
    level3=[[UIImageView alloc]initWithFrame:CGRectMake(34*PER_WIDTH, thirdLb.bottom+8*PER_HEIGHT, levelImg.size.width*PER_WIDTH, levelImg.size.height*PER_HEIGHT)];
    level3.image=levelImg;
    [bgView addSubview:level3];
    postion3=[MyControl createLabelWithFrame:CGRectMake(level3.right+10*PER_WIDTH, thirdLb.bottom+10*PER_HEIGHT, 60*PER_WIDTH, 12*PER_HEIGHT) Font:12 Text:@"小萝莉" Color:FEELT_COLOR];
    
    [bgView addSubview:postion3];
    location3=[MyControl createLabelWithFrame:CGRectMake(0, postion3.bottom+10*PER_HEIGHT, 117*PER_WIDTH, 12*PER_HEIGHT) Font:12 Text:@"深圳金珠珠宝店" Color:FEELT_COLOR];
    location3.textAlignment=NSTextAlignmentCenter;
    [bgView addSubview:location3];
    rank3=[MyControl createLabelWithFrame:CGRectMake(0, location3.bottom+9*PER_HEIGHT, 117*PER_WIDTH, 21*PER_HEIGHT) Font:21 Text:@"220" Color:BLACK_COLOR];
    rank3.font=[UIFont fontWithName:HLT size:21*PER_WIDTH];
    rank3.textAlignment=NSTextAlignmentCenter;
    [bgView addSubview:rank3];
    //第二
    UIImageView*secondBg=[[UIImageView alloc]initWithFrame:CGRectMake(bgView.width-84*PER_WIDTH, 36*PER_HEIGHT, 50*PER_WIDTH,70* PER_WIDTH)];
    secondBg.image=[UIImage imageNamed:@"ico_No2"];
    [bgView addSubview:secondBg];
    second=[[UIImageView alloc]initWithFrame:CGRectMake(0, 20*PER_HEIGHT, 50*PER_WIDTH, 50*PER_WIDTH)];
    second.image=[UIImage imageNamed:@"touxiang_No2"];
    [secondBg addSubview:second];
    
    secondLb=[MyControl createLabelWithFrame:CGRectMake(242*PER_WIDTH, secondBg.bottom+5*PER_HEIGHT, 117*PER_WIDTH, 15*PER_HEIGHT) Font:15 Text:@"流星星" Color:BLACK_COLOR];
    secondLb.textAlignment=NSTextAlignmentCenter;
    [bgView addSubview:secondLb];
    
    level2=[[UIImageView alloc]initWithFrame:CGRectMake(276*PER_WIDTH, thirdLb.bottom+8*PER_HEIGHT, levelImg.size.width*PER_WIDTH, levelImg.size.height*PER_HEIGHT)];
    level2.image=levelImg;
    [bgView addSubview:level2];
    postion2=[MyControl createLabelWithFrame:CGRectMake(level2.right+10*PER_WIDTH, thirdLb.bottom+10*PER_HEIGHT, 60*PER_WIDTH, 12*PER_HEIGHT) Font:12 Text:@"小萝莉" Color:FEELT_COLOR];
    [bgView addSubview:postion2];
    location2=[MyControl createLabelWithFrame:CGRectMake(242*PER_WIDTH, postion3.bottom+10*PER_HEIGHT, 117*PER_WIDTH, 12*PER_HEIGHT) Font:12 Text:@"深圳金珠珠宝店" Color:FEELT_COLOR];
    location2.textAlignment=NSTextAlignmentCenter;
    [bgView addSubview:location2];
    rank2=[MyControl createLabelWithFrame:CGRectMake(location2.left, location3.bottom+9*PER_HEIGHT, 117*PER_WIDTH, 21*PER_HEIGHT) Font:21 Text:@"220" Color:BLACK_COLOR];
    rank2.font=[UIFont fontWithName:HLT size:21*PER_WIDTH];
    rank2.textAlignment=NSTextAlignmentCenter;
    [bgView addSubview:rank2];

    return headerView;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
